package com.tan.websocket.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import io.netty.handler.codec.http.websocketx.WebSocketFrame;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author Tan
 * @description 二进制
 * @date 2025/1/26
 */
@Slf4j
@Service
public class FrameBinaryService extends MainFrameAbstractService {
    @Override
    public void handleMessage(ChannelHandlerContext ctx, WebSocketFrame frame) {
        //处理二进制类型的帧
        log.info("接收到二进制类型的帧");
    }

    @Override
    public boolean isFrameType(WebSocketFrame frame) {
        return frame instanceof BinaryWebSocketFrame;
    }

    @Override
    public String serviceName() {
        return BinaryWebSocketFrame.class.getSimpleName();
    }

}
